package expriment3_bag;
import java.util.Scanner;
public class Eighteen {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr={11,34,47,19,5,87,63,88};
        System.out.println("原数组如下：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + "\t");
        }
        System.out.println();
        System.out.println("请输入要查找的数：");
        int a=scanner.nextInt();
        for (int i = 0; i < arr.length; i++) {
            if(a==arr[i]){
                System.out.println(a+"在数组中的索引为："+i);break;
            } else if (i== arr.length-1) {
                System.out.println("该数组中没有该元素："+a);
            }
        }
    }
}
